classdef dotsQueryableEyeRandom < dotsQueryableEye
    % @class dotsQueryableEyeRandom
    % Acquires and classifies fake point of gaze and pupil size data.
    % @details
    % dotsQueryableEyeRandom extends the dotsQueryableEye superclass to
    % acquire fake, random "point of gaze" and "pupil size" data.  The
    % x, y, and pupil size will walk randomly.  dotsQueryableEyeRandom
    % is a place holder for a real dotsQueryableEye* class.
    % @details
    % dotsQueryableEyeRandom is a usable class.  Use the newObject()
    % method of dotsTheQueryablesManager to create new
    % dotsQueryableEyeRandom objects.
    % @ingroup queryable
    
    properties
        % false x-position, as though from eye tracker hardware
        inputX;
        
        % false y-position, as though from eye tracker hardware
        inputY;
        
        % false pupil size, as though from eye tracker hardware
        inputPupil;
    end
    
    methods
        % Acquire device-specific resources.
        % @details
        % Since dotsQueryableEyeRandom is just a placeholder, does not try
        % to connect to a device and always returns true.
        function isOpen = openEyeTracker(self)
            self.inputRect = [0 0 1 1];
            self.xyRect = [-10 -10 20 20];
            self.pupilMax = 1000;
            
            self.inputX = self.inputRect(1) + self.inputRect(3)/2;
            self.inputY = self.inputRect(2) + self.inputRect(4)/2;
            self.inputPupil = self.pupilMax/2;
            
            self.sampleFrequency = 60;
            
            isOpen = true;
        end
        
        % Release device-specific resources.
        % @details
        % Since dotsQueryableEyeRandom is just a placeholder, does nothing;
        function closeEyeTracker(self)
        end
        
        % Read raw data from the acquired eye tracker device.
        % @details
        % Generates a random data sample for each of the x, y, and pupil
        % size dimensions.  Each dimension will walk randomly.
        function data = readRawData(self)
            walkStep = ((2*rand(1,3))-1)./self.sampleFrequency;
            self.inputX = self.inputX + walkStep(1)*self.inputRect(3);
            self.inputY = self.inputY + walkStep(2)*self.inputRect(4);
            self.inputPupil = self.inputPupil + walkStep(3)*self.pupilMax;
            data = [ ...
                self.xID, self.inputX, topsClock; ...
                self.yID, self.inputY, topsClock; ...
                self.pupilID, self.inputPupil, topsClock];
        end
    end
end